#define _CRT_SECURE_NO_WARNINGS 1


#include<stack>
#include<iostream>

using namespace std;

class MyQueue
{
public:
    /** Initialize your data structure here. */
    MyQueue()
    {

    }

    /** Push element x to the back of queue. */
    void push(int x)
    {
        push_st.push(x);
    }

    /** Removes the element from in front of queue and returns that element. */
    int pop()
    {
        if (pop_st.empty())
        {
            while (!push_st.empty())
            {
                pop_st.push(push_st.top());
                push_st.pop();
            }
        }
        int top = pop_st.top();
        pop_st.top();
        return top;
    }

    /** Get the front element. */
    int peek()
    {
        if (pop_st.empty())
        {
            while (!push_st.empty())
            {
                pop_st.push(push_st.top());
                push_st.pop();
            }
        }
        int top = pop_st.top();
        return top;
    }

    /** Returns whether the queue is empty. */
    bool empty()
    {
        return push_st.empty() && pop_st.empty();
    }
private:
    stack<int> push_st;
    stack<int> pop_st;
};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */